import java.util.Scanner;

public class Haha {
    public static void main8(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String a = scanner.nextLine();
        int n = 0;
        int last = a.length() - 1;
        while( n < last){
            if (a.charAt(n) == a.charAt(last)) {
                n++;
                last--;
            } else {
                System.out.println("此数不是回文数");
                break;
            }
        }
        if( n == last) {
            System.out.println("此数是回文数");
        }

    }

//=====================================
    public static void main(String[] args) {
        int[] arr = new int[]{1,8,15,27,33,56,89};
        Scanner sc = new Scanner(System.in);
        int n = sc.nextInt();
        int m = 0;
        for (; m < arr.length; m++) {
            if (arr[m] == n) {
                System.out.println(m);
                break;
            }

        }
        if (m == arr.length) {
            System.out.println(-1);
        }

    }

//=======================================
    public static void main7(String[] args) {
        Scanner sc = new Scanner(System.in);
        int[] arr = new int[10];
        for (int i = 0; i<arr.length;i++) {
            arr[i] = sc.nextInt();
        }

        for (int i = 0 ; i < arr.length-1;i++) {
            for (int j = 0; j < arr.length-1-i; j++) {
                if (arr[j] >arr[j+1]) {
                    int t = 0;
                    t = arr[j];
                    arr[j] = arr[j+1];
                    arr[j+1] = t;
                }
            }
        }

        for (int i = 0; i < arr.length; i++) {
            System.out.print(arr[i]+" ");
        }
    }
    //===============================================================
    public static void main88(String[] args) {
        int[] arr = new int[101];
        int people = 100;
        int num = 3;
        int count = 0;
        int k = 0;
        int i = 0;
        int [] arr2 = new int[100];
        int m = 0;
        while(count != people) {
            i++;
            if(i > people) {
                i = 1;
            }
            if(arr[i] == 0) {
                k++;
                if (k == num) {
                    arr2[m] = i;
                    k = 0;
                    count++;
                    m++;
                }

            }
        }
        System.out.println(arr2[arr2.length-1]);

    }
}
